package com.stylefeng.guns.rest.common;

import com.stylefeng.guns.api.user.UserInfoModer;

/**
 * @ClassName CurrentUser
 * @Description TODO
 * @Author zhaoluowei
 * @Date 2019/9/9  0:32
 * @Version 1.0
 */

public class CurrentUser {

    //线程绑定 存储空间
    //private static final ThreadLocal<String> threadLocal = new ThreadLocal<>();

    //允许线程切换的 threadLocal
    private static final InheritableThreadLocal<String> threadLocal = new InheritableThreadLocal<>();

    public static void saveUserInfo(String userInfoModer){
        threadLocal.set(userInfoModer);
    }

    public static String getCurrentUserInfoModer(){
        return threadLocal.get();
    }


//    public static void saveUserInfo(UserInfoModer userInfoModer){
//        threadLocal.set(userInfoModer);
//    }
//
//    public static UserInfoModer getCurrentUserInfoModer(){
//       return threadLocal.get();
//    }


}
